package cn.sirun.com.fca.map.loader;

import com.tencent.cloud.iov.kernel.model.BaseResponse;

import cn.sirun.com.fca.map.model.repose.MapCarLocation;
import cn.sirun.com.fca.map.model.repose.MapCollectedResponse;
import cn.sirun.com.fca.map.model.repose.MapHomeCompanyResponse;
import cn.sirun.com.fca.map.model.request.MapAddCollectedRequest;
import cn.sirun.com.fca.map.model.request.MapDeleteCollected;
import cn.sirun.com.fca.map.model.request.MapSendCarRequest;
import cn.sirun.com.fca.map.repo.MapRepository;
import io.reactivex.Observable;
import io.reactivex.schedulers.Schedulers;

/**
 * Descrip:
 * Author: Administrator
 * Time: 2018/12/2
 * Version:
 */

public class MapLoader extends MapFlowLoader {
    //查看收藏夹
    public Observable<BaseResponse<MapCollectedResponse>> mapcollected(String din, String startPage, String pageSize) {
        return MapRepository.getInstance().mapcollected(din, startPage, pageSize).subscribeOn(Schedulers.io());
    }
    //添加收藏夹
    public Observable<BaseResponse<MapCollectedResponse>> mapaddcollect(String din, MapAddCollectedRequest mapAddCollectedRequest) {
        return MapRepository.getInstance().mapaddcollect(din, mapAddCollectedRequest).subscribeOn(Schedulers.io());
    }

    //删除收藏夹
    public Observable<BaseResponse<Void>> mapDeleteCollected(String din, MapDeleteCollected mapDeleteCollected) {
        return MapRepository.getInstance().mapDeleteCollect(din, mapDeleteCollected).subscribeOn(Schedulers.io());
    }

    //家和公司地址
    public Observable<BaseResponse<MapHomeCompanyResponse>> mapHomeCompany(String din) {
        return MapRepository.getInstance().mapHomeCompany(din).subscribeOn(Schedulers.io());
    }

    //发送地址到车
    public Observable<BaseResponse<BaseResponse>> mapSendToCar(String din, MapSendCarRequest mapSendCarRequest) {
        return MapRepository.getInstance().mapSendToCar(din, mapSendCarRequest).subscribeOn(Schedulers.io());
    }

    //获取最近一次上传位置
    public Observable<BaseResponse<MapCarLocation>> getLastLocation(String din) {
        return MapRepository.getInstance().getLastLocation(din).subscribeOn(Schedulers.io());
    }

    //更新车的位置
    public Observable<BaseResponse<MapCarLocation>> updateLocation(String din) {
        return MapRepository.getInstance().updateLocation(din).subscribeOn(Schedulers.io());
    }
}
